/**
 * 
 */
package net.hust.service;

import java.util.Collection;

/**
 * @author Administrator
 * 
 */
public class Page {

	private Integer pageNo = 1; 
	private Integer pageSize; 
	private Collection content; 
	private Long totalRecNum;
	
	public Page(Integer pageNo)
	{
		super();
		this.pageNo=pageNo;
		this.pageSize=10;
	}
	
    public Page()
    {
    	this(1);
    }

	public Integer getPageNo() {
		return pageNo;
	}

	public void setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Collection getContent() {
		return content;
	}

	public void setContent(Collection content) {
		this.content = content;
	}

	public Long getTotalRecNum() {
		return totalRecNum;
	}

	public void setTotalRecNum(Long totalRecNum) {
		this.totalRecNum = totalRecNum;
	}

	public Integer getTotalPageNum() {
		return totalRecNum%pageSize!=0?(int)(totalRecNum/pageSize+1):(int)(totalRecNum/pageSize);
	}

	public Boolean getPrePage() {
		return pageNo>1;
	}

	public Boolean getNextPage() {
		return pageNo<this.getTotalPageNum();
	}

	public Long getStartIndex() {
		return 1L*pageSize*(pageNo-1)+1;
	}

	public Long getEndIndex() {
		return pageSize*pageNo>this.getTotalRecNum()?this.getTotalRecNum():pageSize*pageNo;
	}


}
